import { BrowserRouter as Router, Route, Redirect, Switch } from 'react-router-dom'
// import Layout from './pages/Layout'
// import Login from './pages/Login'
// 懒加载
import React from 'react'
import Loading from '@/components/Loading'
const Layout = React.lazy(() => import('@/pages/Layout'))
const Login = React.lazy(() => import('@/pages/Login'))
const NotFound = React.lazy(() => import('@/pages/NotFound'))

export default function App() {
  return (
    <Router>
      <React.Suspense fallback={<Loading />}>
        <Switch>
          <Redirect exact path='/' to='/login' />
          <Route path='/layout' component={Layout} />
          <Route path='/login' component={Login} />
          <Route path='*' component={NotFound} />
        </Switch>
      </React.Suspense>
    </Router>
  )
}
